#include <pbstdlib.h>
#include "define.h"


void delay_ms( uint16_t n) {
    uint16_t start =   ((unsigned)__input(TIM_BASEADDR+1)<<8)| __input(TIM_BASEADDR) ;
    uint16_t end ;
    start = start + n ;

    for(;;) {
        end = ((unsigned)__input(TIM_BASEADDR+1)<<8)| __input(TIM_BASEADDR) ;
        if(end > start) {
            break  ;
        }
    }
}


int main()
{
    uint8_t s = 0;
    while(1) {
        __output(GPIO_BASEADDR, s);
        // delay_ms(500);
        s=s+1;
    }

    return 0 ;
}
